package com.copsoftware.reportes.geografico.support;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import com.copsoftware.reportes.geografico.beans.BeanJSONString;
import com.copsoftware.support.json.JSONObject;

public class BeanJSONStringBuilder {
	public static BeanJSONString execute(Object element)
	{	
		JSONObject jsonObject = new JSONObject(element);
		BeanJSONString bnBeanJSONString = new BeanJSONString(jsonObject.toString());
		return bnBeanJSONString; 
	}

	public static List execute (List elements)
	{
		List listJSONObjects = new ArrayList();
		
		for (Iterator iter = elements.iterator(); iter.hasNext();) {
			JSONObject element = (JSONObject) iter.next();
			BeanJSONString bnBeanJSONString = new BeanJSONString(element.toString());
		   listJSONObjects.add(bnBeanJSONString);
		}
		return listJSONObjects;
	}
}
